package com.yh.mp.controller;

import com.yh.mp.pojo.BookInfo;
import com.yh.mp.pojo.User;
import com.yh.mp.service.IBookInfoService;
import com.yh.mp.service.IUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/books")
@RequiredArgsConstructor
public class BookInfoController {
    private final IBookInfoService bookInfoService;

    @PostMapping("/add")
    public void add(@RequestBody BookInfo bookInfo){
        bookInfoService.save(bookInfo);

    }

    @GetMapping("/all")
    public List<BookInfo> all(){
        return bookInfoService.list();
    }

}
